<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>当日现摘 生鲜直达</title>
    <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0,user-scalable=no' />
    <link rel="stylesheet" href="css/swiper.min.css">
    <link rel="stylesheet" href="css/animate.min.css">
    <link rel="stylesheet" href="css/main.css">
    <script src="js/swiper.min.js"></script>
    <script src="js/swiper.animate.min.js"></script>
</head>

<body>
    <!-- <audio src="upload/mp3.mp3" autoplay loop style="display:none">
    </audio> -->
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <!-- page1 -->
            <section class="swiper-slide swiper-slide0">

            </section>
            <!-- page2 -->
            <section class="swiper-slide swiper-slide1">

            </section>
            <!-- page3 -->
            <section class="swiper-slide swiper-slide2">

            </section>
            <!-- page4 -->
            <section class="swiper-slide">
              <div class="infoSubmit">
                <div class="header">信息填报</div>
                <ul>
                  <li>
                    <div>姓<u>隐</u><u>隐</u>名</div>
                    <input id="name" type="text" maxlength="25"/>
                  </li>
                  <li>
                    <div>手机号码</div>
                    <input id="phone" type="number" maxlength="11"/>
                  </li>
                  <li>
                    <div>单<u>隐</u><u>隐</u>位</div>
                    <input id="company" type="text" maxlength="50"/>
                  </li>
                  <li>
                    <div>地<u>隐</u><u>隐</u>址</div>
                    <select class="addressProvince" name="">
                      <option value="">请选择省份</option>
                    </select>
                    <select class="addressCity" name="">
                      <option value="">请选择城市</option>
                    </select>
                    <select class="addressArea" name="">
                      <option value="">请选择地区</option>
                    </select>
                    <textarea id="address" name="name" rows="4"></textarea>
                  </li>
                  <li class="submit">
                    <div id="submitBtn" class="submitBtn">提交</div>
                  </li>
                </ul>
              </div>
            </section>
        </div>
        <img src="images/next.png" style="width:30px;height:20px; bottom:10px; left:0;right:0;margin:auto" id="array" class="resize">
        <!-- <div class="swiper-pagination"></div> -->
    </div>

    <script src="js/jquery.min.js" charset="utf-8"></script>
    <script src="js/main.config.js" charset="utf-8"></script>
    <script src="js/areapicker.js" charset="utf-8"></script>
    <script type="text/javascript">
      var HOST = 'http://activity.didadiandan.com';
      var addressWidget = new AddressWidget({url:HOST+'/common/getArea'});
      addressWidget.init();
      $('#submitBtn').click(function () {
        var name = $('#name').val();
        var phone = $('#phone').val();
        var company = $('#company').val();
        var address = $('#address').val();
        $.post(HOST+'/web/pipa/join', {
          key:getQueryString().key,
          name:name,
          mobile:phone,
          companyName:company,
          province:addressWidget.provinceValue,
          provinceName:addressWidget.provinceName,
          city:addressWidget.cityValue,
          cityName:addressWidget.cityName,
          area:addressWidget.areaValue,
          areaName:addressWidget.areaName,
          address:address,
        }, function(result) {
            if(100 != result.code){
                alert(result.message);
                return;
            }
            window.location.href = "./success.html";
        }, "json");
        //console.log(addressWidget.provinceValue);
        //console.log(addressWidget.cityValue);
        //console.log(addressWidget.areaValue);
      });

      function getQueryString() {
          var obj = {};
          var url = window.location.search;
          if (url.indexOf("?") != -1) {
              var str = url.substr(1);
              var strs = str.split("&");
              for (var i = 0; i < strs.length; i++) {
                  obj[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
              }
              return obj;
          }
      }
    </script>
</body>

</html>
